-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add last resolve time metric #52
Conversation
@sercand please review this PR, Thanks |
builder.go
Outdated
@@ -283,6 +296,7 @@ func (k *kResolver) watch() error { | |||
if hasMore { | |||
k.handle(up.Object) | |||
} else { | |||
k.lastResolve.Set(float64(time.Since(k.lastResolveTime).Seconds())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lalalalatt do you achieve what do you want with this change or did your test it? I don't think that lastResolve will update frequently therefore what you will see is "0" on prometheus metrics.
@sercand Thanks for the correction. And now I have added a test for the ❯ go test . -v
=== RUN TestBuilder
0, address: 192.168.194.47:53
0, servername: kube-dns.kube-system
--- PASS: TestBuilder (0.02s)
+ === RUN TestResolveLag
+ 0, address: 192.168.194.47:53
+ 0, servername: kube-dns.kube-system
+ builder_test.go:93: client resolver lag: 2 s
+ --- PASS: TestResolveLag (2.01s)
=== RUN TestParseResolverTarget
--- PASS: TestParseResolverTarget (0.00s)
=== RUN TestParseTargets
--- PASS: TestParseTargets (0.00s)
PASS
ok github.com/sercand/kuberesolver/v5 |
I change the metric to record the latest groups:
- name: update_state_alerts
rules:
- alert: UpdateStateStale
expr: time() - last_update_state_time_seconds > 60
for: 1m
labels:
severity: critical
annotations:
summary: "UpdateState has not been called recently"
description: "It has been more than 60 seconds since the last UpdateState call." |
As the description in authzed/spicedb#422: